
local yujue = fk.CreateSkill{
  name = "lvshi__yujue",
  tags = { Skill.Lord }
}

Fk:loadTranslationTable{
  ["lvshi__yujue"] = "豫决",
  [":lvshi__yujue"] = "主公技，出牌阶段开始时，其他群势力角色可依次交给你一张牌。",
  ["#lvshi__yujue"] = "豫决：你可以交给 %src 一张牌",
}

yujue:addEffect(fk.EventPhaseStart, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(yujue.name) and player.phase == Player.Play
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    for _, p in ipairs(room:getOtherPlayers(player)) do
      if p.kingdom == "qun" and not p.dead then
        local cards = room:askToCards(p, {
          min_num = 1,
          max_num = 1,
          include_equip = true,
          skill_name = yujue.name,
          cancelable = true,
          prompt = "#lvshi__yujue:"..player.id
        })
        if #cards > 0 then
          room:obtainCard(player, cards, true, fk.ReasonGive, p, yujue.name)
        end
      end
    end
  end,
})

return yujue